#include <iostream>

#include "predictor_target.h"
#include "predictor_link.h"

using namespace std;

Predictor_target::Predictor_target(std::string id) :
  Predictor_base(id)
{
  _string_type = "Target";

  // make predictor connections
  add_input_link(new Predictor_link(PARAMETER)); // target
  add_input_link(new Predictor_link(INPUT)); // target

  _predicted_inputs.resize(_input_links.size());

  _complexity = 1.0;
}

Predictor_target::~Predictor_target()
{
}

void Predictor_target::save_state(float time)
{
  save_input(time);
}

void Predictor_target::predict(float)
{
  //  cout << " # predictor_target: Predicting" << endl;
  _predicted_inputs[1] = _input_links[0]->get_value(); // target
}

void Predictor_target::activate_output_link(void)
{
  //cout << "activate_output_link" << endl;
  if (_active) {
    _output_link->activate();
  }
  else {
    //    cout << "  " << _string_id << ":  De-activating output " << endl;
    _output_link->deactivate();
  }
}

void Predictor_target::info(stringstream &ss)
{
  Predictor_base::info(ss);
  ss << "Target: " << _input_links[0]->get_value() << endl;
}
